The present invention relates to a register device used in a computer. In a computer, when a subroutine call or interruption is generated, current processing is temporarily stopped to execute another processing, and after this processing is completed, the interrupted processing is resumed. In this case, the contents of one or more registers must be saved and the saved contents must be returned to the original registers for recovery. The present invention relates to a register device having a function of performing saving/recovery of contents of registers at a high speed.
In a conventional computer system, the saving/ recovery of contents of registers during processing in which a subroutine is called and processing jumps from a main routine to the subroutine, i.e., subroutine call processing and processing for returning from the subroutine to the main routine, i.e., return processing are generally processed by a program in the main routine and the subroutine using PUSH and POP instructions for handling a stack. However, a system using such a program leads to an overhead in the subroutine processing, thereby preventing a high speed operation of the subroutine processing.
In order to cope with the above problem, a system disclosed in "Reduced Instruction Set Computer Architectures for VLSI.", M.G.H. Katevenis, MIT Press, 1984, i.e., a system using a register window has been proposed. In this system, a register window is changed during the subroutine processing, thereby saving the contents of the registers. During the return processing after the subroutine processing is completed, the register window is returned to its original state to recover the saved contents of the registers. In this case, along with execution of the subroutine call, although the contents of the registers are saved, the contents of the registers before the subroutine call are all changed. Therefore, data stored in the registers in the main routine cannot be referred to in the subroutine.
Also, a system in which processing using a register window is used in combination with normal register processing is known. In this case, however, saving/ recovery of contents of registers is performed using a program in the normal register processing. Therefore, an object of eliminating the overhead of the subroutine processing cannot be achieved.
The above problem significantly appears when a program in which Prolog is used as a program language is executed. That is, since Prolog processing is based on a knowledge tree structure, information stored in a register set must be saved every time the processing reaches a choice point (branch point of the knowledge tree structure), and information of a register set must remain after it is saved. In addition, if a back track, i.e., returning in the knowledge tree is generated, the register set must be recovered to a state existing at an immediately preceding choice point. That is, in nondeterministic inference processing of Prolog, such choice point processing and back tracks are frequently repeated. Therefore, the time lost during saving/ recovery of the registers largely reduces a processing speed.
As described above, according to a conventional register saving system using a program, the speed of the saving/recovery operation cannot be increased. In addition, according to a system using a register window, information concerning contents of registers after saving cannot be stored.